JBoss Community Archive (Read Only)

RHQ

CLI Modules in Python

RHQ has the notion of "script source providers" which is a pluggable mechanism for providing source files from various sources. This is in principle similar to the import hooks offered by Python. To make the RHQ's source providers interact with Python's import mechanism one needs to do the following:

import sys
sys.path.append("__rhq__:root_of_the_uri_needed_by_a_particular_source_provider/")

import my_module

This will translate into the script being downloaded from "root_of_the_uri_needed_by_a_particular_source_provider/my_module.py" (i.e. the "root" and the module name are simply concatenated together and ".py" is added to the end).

A concrete example for downloading a script from the RHQ repository:

import sys
sys.path.append("__rhq__:rhq://repositories/my_repo/")

import my_script

This will import the module called "my_script.py" in the repository "my_repo" on the RHQ server.

Please consult the Script Sources page for the list of the script source providers included by default and about the way how to provide your own.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:43:30 UTC, last content change 2012-08-24 13:21:48 UTC.